package org.ascollada.core
{
	import org.ascollada.ASCollada;
	import org.ascollada.core.log.DaeLogger;
	
	public class DaeInput extends DaeElement
	{
		public var semantic	:String;
		public var offset	:int;
		public var setID	:int;
		public var source	:String;
		
		public function DaeInput(document:DaeDocument, node:XML=null)
		{
			super(document, node);
		}
		
		/**
		 * Reads the node.
		 * 
		 * @param	node
		 */ 
		public override function read(node:XML):void
		{
			if(node.name().localName != ASCollada.DAE_INPUT_ELEMENT)
			{
				DaeLogger.error("Not a " + ASCollada.DAE_INPUT_ELEMENT + " element!");
				throw new Error("Not a " + ASCollada.DAE_INPUT_ELEMENT + " element!");
			}
			
			super.read( node );
			
			this.semantic = node.@semantic.toString();
			this.source = stripPound(node.@source.toString());
			this.offset = node.@offset.toString() != "" ? parseInt(node.@offset.toString(), 10) : 0;
			this.setID = node.@set.toString() != "" ? parseInt(node.@set.toString(), 10) : 0;
		}
	}
}